Skip to content

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Oct 8, 2025

We shouldn't use a cache slot while writing as it would allow to bypass the custom "read only" behaviour. (Note that this is not a "real" readonly, it is more like a "writeonce")

…y implemented

We shouldn't use a cache slot while writing as it would allow to bypass
the custom "read only" behaviour. (Note that this is not a "real"
readonly, it is more like a "writeonce")
@nielsdos nielsdos linked an issue Oct 8, 2025 that may be closed by this pull request
@nielsdos nielsdos marked this pull request as ready for review October 8, 2025 20:42
?>
--FILE--
<?php
$stmt = new PDOStatement();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it even legal to manually construct a PDOStatement?! I'm not sure if this is worth fixing, since for “properly created” PDOStatements writing just fails.

In fact, can't we just make it properly readonly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer to both your questions appears to be: mocking, see https://bugs.php.net/81084

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer to both your questions appears to be: mocking, see

sigh

Then we might be able to public public(set) readonly nowadays?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or alternatively making it public protected(set) readonly (i.e. readonly) and asking folks to go through Reflection for this kind of use case might also be okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDOStatement::$queryString "readonly" is not properly implemented

2 participants